import { getUserApi, getUserProfileApi } from '@/api/user'
import { RootThunkAction } from '../../types/store.d'
export const getUser = (): RootThunkAction => {
  return async (dispatch) => {
    const res = await getUserApi()

    dispatch({
      type: 'profile/getUser',
      payload: res.data.data,
    })
  }
}

export const getUserProfile = (): RootThunkAction => {
  return async (dispatch) => {
    const res = await getUserProfileApi()
    // console.log(res.data.data.birthday)

    dispatch({
      type: 'profile/getUserProfile',
      payload: res.data.data,
    })
  }
}
